<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=753984
-->
  <head>
    <title>[AccessFu] utterance order test</title>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css"
          href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    <script type="application/javascript"
            src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    <script type="application/javascript"
            src="../common.js"></script>
    <script type="application/javascript"
            src="./output.js"></script>
    <script type="application/javascript"
            src="./jsatcommon.js"></script>
    <script type="application/javascript">

      function doTest() {
        // Test the following accOrElmOrID (with optional old accOrElmOrID).
        // Note: each accOrElmOrID entry maps to a unique object utterance
        // generator function within the UtteranceGenerator.
        var tests = [{
          accOrElmOrID: "anchor",
          expectedUtterance: [[{"string": "link"}, "title"],
            ["title", {"string": "link"}]],
          expectedBraille: [[{"string": "linkAbbr"}, "title"],
            ["title", {"string": "linkAbbr"}]]
        }, {
          accOrElmOrID: "anchor_titleandtext",
          expectedUtterance: [[{"string": "link"}, "goes to the tests -",
            "Tests"], ["Tests", "- goes to the tests", {"string": "link"}]],
          expectedBraille:   [[{"string": "linkAbbr"}, "goes to the tests -",
            "Tests"], ["Tests", "- goes to the tests", {"string": "linkAbbr"}]],
        }, {
          accOrElmOrID: "anchor_duplicatedtitleandtext",
          expectedUtterance: [[{"string": "link"}, "Tests"],
            ["Tests", {"string": "link"}]],
          expectedBraille: [[{"string": "linkAbbr"}, "Tests"],
            ["Tests", {"string": "linkAbbr"}]]
        }, {
          accOrElmOrID: "anchor_arialabelandtext",
          expectedUtterance: [[{"string": "link"}, "goes to the tests - Tests"],
            ["Tests - goes to the tests", {"string": "link"}]],
          expectedBraille: [[{"string": "linkAbbr"},
            "goes to the tests - Tests"], ["Tests - goes to the tests",
            {"string": "linkAbbr"}]],
        }, {
          accOrElmOrID: "textarea",
          expectedUtterance: [[{"string": "textarea"},
            "This is the text area text."], ["This is the text area text.",
            {"string": "textarea"}]],
          expectedBraille: [[{"string": "textareaAbbr"},
            "This is the text area text."], ["This is the text area text.",
            {"string": "textareaAbbr"}]],
        }, {
          accOrElmOrID: "heading",
          expectedUtterance: [[{"string": "headingLevel", "args": [1]},
            "Test heading"], ["Test heading",
            {"string": "headingLevel", "args": [1]}]],
          expectedBraille: [[{"string": "headingAbbr"}, "Test heading"],
                            ["Test heading", {"string": "headingAbbr"}]]
        }, {
          accOrElmOrID: "list",
          expectedUtterance: [[{"string": "list"},
            {"string": "listItemsCount", "count":1}, {"string": "listStart"},
            "1.", "list one"], ["1.", "list one", {"string": "listStart"},
            {"string": "list"}, {"string": "listItemsCount", "count":1}]
          ],
          expectedBraille: [[{"string": "listAbbr"}, "list one"],
            ["list one", {"string": "listAbbr"}]]
        }, {
          accOrElmOrID: "dlist",
          expectedUtterance: [[{"string": "definitionlist"},
            {"string": "listItemsCount", "count": 0.5}, "dd one"], ["dd one",
            {"string": "definitionlist"},
            {"string": "listItemsCount", "count": 0.5}]
          ],
          expectedBraille: [[{"string": "definitionlistAbbr"}, "dd one"],
                            ["dd one", {"string": "definitionlistAbbr"}]]
        }, {
          accOrElmOrID: "li_one",
          expectedUtterance: [[{"string": "list"},
            {"string": "listItemsCount", "count": 1}, {"string": "listStart"},
            "1.", "list one"], ["1.", "list one", {"string": "listStart"},
            {"string": "list"}, {"string": "listItemsCount", "count": 1}]
          ],
          expectedBraille: [["1.", "list one"], ["1.", "list one"]]
        },
        {
          accOrElmOrID: "li_two",
          expectedUtterance: [[{"string": "list"},
            {"string": "listItemsCount", "count": 1}, {"string": "listStart"},
            "list two"], ["list two", {"string": "listStart"},
            {"string": "list"}, {"string": "listItemsCount", "count": 1}]
          ],
          expectedBraille: [["*", "list two"], ["*", "list two"]]
        }, {
          accOrElmOrID: "cell",
          expectedUtterance: [[{"string":"table"},
            {"string": "tblColumnInfo", "count": 1},
            {"string": "tblRowInfo", "count": 1}, "Fruits and vegetables",
            {"string": "columnInfo", "args": [1]},
            {"string": "rowInfo", "args": [1]}, {"string": "list"},
            {"string": "listItemsCount", "count": 4}, {"string": "listStart"},
            {"string": "link"}, "Apples", {"string": "link"}, "Bananas",
            {"string": "link"}, "Peaches", {"string": "listEnd"},
            {"string": "link"}, "Plums"], ["Apples", {"string": "link"},
            {"string": "listStart"}, "Bananas", {"string": "link"}, "Peaches",
            {"string": "link"}, "Plums", {"string": "link"},
            {"string": "listEnd"}, {"string": "list"},
            {"string": "listItemsCount", "count": 4},
            {"string": "columnInfo", "args": [1]},
            {"string": "rowInfo", "args": [1]}, "Fruits and vegetables",
            {"string":"table"}, {"string": "tblColumnInfo", "count": 1},
            {"string": "tblRowInfo", "count": 1}]],
          expectedBraille: [[{"string": "cellInfoAbbr", "args": [ 1, 1]},
            {"string": "listAbbr"}, {"string": "linkAbbr"}, "Apples",
            {"string": "linkAbbr"}, "Bananas", {"string": "linkAbbr"},
            "Peaches", {"string": "linkAbbr"}, "Plums"], ["Apples",
            {"string": "linkAbbr"}, "Bananas", {"string": "linkAbbr"},
            "Peaches", {"string": "linkAbbr"}, "Plums", {"string": "linkAbbr"},
            {"string": "listAbbr"},
            {"string": "cellInfoAbbr", "args": [ 1, 1]}]]
        }, {
          accOrElmOrID: "email",
          expectedUtterance: [[{"string": "textInputType_email"},
            {"string": "entry"}, "test@example.com"], ["test@example.com",
            {"string": "textInputType_email"}, {"string": "entry"}]],
          expectedBraille: [[{"string": "textInputType_email"},
            {"string": "entryAbbr"}, "test@example.com"], ["test@example.com",
            {"string": "textInputType_email"}, {"string": "entryAbbr"}]]
        }, {
          accOrElmOrID: "search",
          expectedUtterance: [[{"string": "textInputType_search"},
            {"string": "entry"}, "This is a search"], ["This is a search",
            {"string": "textInputType_search"}, {"string": "entry"}]],
          expectedBraille: [[{"string": "textInputType_search"},
            {"string": "entryAbbr"}, "This is a search"], ["This is a search",
            {"string": "textInputType_search"}, {"string": "entryAbbr"}]]
        }, {
          accOrElmOrID: "tel",
          expectedUtterance: [[{"string": "textInputType_tel"},
            {"string": "entry"}, "555-5555"], ["555-5555",
            {"string": "textInputType_tel"}, {"string": "entry"}]],
          expectedBraille: [[{"string": "textInputType_tel"},
            {"string": "entryAbbr"}, "555-5555"], ["555-5555",
            {"string": "textInputType_tel"}, {"string": "entryAbbr"}]]
        }, {
          accOrElmOrID: "url",
          expectedUtterance: [[{"string": "textInputType_url"},
            {"string": "entry"}, "http://example.com"], ["http://example.com",
            {"string": "textInputType_url"}, {"string": "entry"}]],
          expectedBraille: [[{"string": "textInputType_url"},
            {"string": "entryAbbr"}, "http://example.com"],
            ["http://example.com", {"string": "textInputType_url"},
            {"string": "entryAbbr"}]]
        }, {
          accOrElmOrID: "textInput",
          expectedUtterance: [[{"string": "entry"}, "This is text."],
                              ["This is text.", {"string": "entry"}]],
          expectedBraille: [[{"string": "entryAbbr"}, "This is text."],
                            ["This is text.", {"string": "entryAbbr"}]]
        }, {
          // Test pivot to list from li_one.
          accOrElmOrID: "list",
          oldAccOrElmOrID: "li_one",
          expectedUtterance: [[{"string": "list"},
            {"string": "listItemsCount", "count": 1}, {"string": "listStart"},
            "1.", "list one"], ["1.", "list one", {"string": "listStart"},
            {"string": "list"}, {"string": "listItemsCount", "count": 1}]
          ],
          expectedBraille: [[{"string": "listAbbr"}, "list one"],
                            ["list one", {"string": "listAbbr"}]]
        }, {
          // Test pivot to "apples" link from the table cell.
          accOrElmOrID: "apples",
          oldAccOrElmOrID: "cell",
          expectedUtterance: [[{"string": "list"},
            {"string": "listItemsCount", "count": 4}, {"string": "listStart"},
            {"string": "link"}, "Apples"], ["Apples", {"string": "link"},
            {"string": "listStart"}, {"string": "list"},
            {"string": "listItemsCount", "count": 4}]
          ],
          expectedBraille: [["*", {"string": "linkAbbr"}, "Apples"],
                            ["*", "Apples", {"string": "linkAbbr"}]]
        }, {
          // Test pivot to "bananas" link from "apples" link.
          accOrElmOrID: "bananas",
          oldAccOrElmOrID: "apples",
          expectedUtterance: [[{"string": "link"}, "Bananas"],
                              ["Bananas", {"string": "link"}]],
          expectedBraille: [["*", {"string": "linkAbbr"}, "Bananas"],
                            ["*", "Bananas", {"string": "linkAbbr"}]]
        }, {
          // test unavailable state utterance
          accOrElmOrID: "unavailableButton",
          expectedUtterance: [[{"string": "stateUnavailable"},
            {"string": "pushbutton"}, "I am unavailable"], ["I am unavailable",
            {"string": "stateUnavailable"}, {"string": "pushbutton"}]],
          expectedBraille: [[{"string": "pushbuttonAbbr"}, "I am unavailable"],
                            ["I am unavailable", {"string": "pushbuttonAbbr"}]]
        }, {
          // test expanded state utterance
          accOrElmOrID: "expandedButton",
          expectedUtterance: [[{"string": "stateExpanded"},
            {"string": "pushbutton"}, "I am expanded"], ["I am expanded",
            {"string": "stateExpanded"}, {"string": "pushbutton"}]],
          expectedBraille: [[{"string": "pushbuttonAbbr"}, "I am expanded"],
                            ["I am expanded", {"string": "pushbuttonAbbr"}]]
        }, {
          // test collapsed state utterance
          accOrElmOrID: "collapsedButton",
          expectedUtterance: [[{"string": "stateCollapsed"},
            {"string": "pushbutton"}, "I am collapsed"], ["I am collapsed",
            {"string": "stateCollapsed"}, {"string": "pushbutton"}]],
          expectedBraille: [[{"string": "pushbuttonAbbr"}, "I am collapsed"],
                            ["I am collapsed", {"string": "pushbuttonAbbr"}]]
        }, {
          // test required state utterance
          accOrElmOrID: "requiredInput",
          expectedUtterance: [[{"string": "stateRequired"}, {"string": "entry"},
            "I am required"], ["I am required", {"string": "stateRequired"},
            {"string": "entry"}]],
          expectedBraille: [[{"string": "entryAbbr"}, "I am required"],
                            ["I am required", {"string": "entryAbbr"}]]
        }, {
          // test unavailable state utterance on inputs
          accOrElmOrID: "readonlyInput",
          expectedUtterance: [[{"string": "stateReadonly"}, {"string": "entry"},
            "No edits"], ["No edits", {"string": "stateReadonly"},
            {"string": "entry"}]],
          expectedBraille: [[{"string": "entryAbbr"}, "No edits"],
                            ["No edits", {"string": "entryAbbr"}]]
        }, {
          // test unavailable state utterance on textareas
          accOrElmOrID: "readonlyTextarea",
          expectedUtterance: [[{"string": "stateReadonly"}, {"string": "textarea"},
            "No editing"], ["No editing", {"string": "stateReadonly"},
            {"string": "textarea"}]],
          expectedBraille: [[{"string": "textareaAbbr"}, "No editing"],
                            ["No editing", {"string": "textareaAbbr"}]]
        }, {
          // test has popup state utterance
          accOrElmOrID: "hasPopupButton",
          expectedUtterance: [[{"string": "stateHasPopup"},
            {"string": "buttonmenu"}, "I have a popup"], ["I have a popup",
            {"string": "stateHasPopup"}, {"string": "buttonmenu"}]],
          expectedBraille: [[{"string": "buttonmenuAbbr"}, "I have a popup"],
                            ["I have a popup", {"string": "buttonmenuAbbr"}]]
        }, {
          // Test selected tab
          accOrElmOrID: "tab1",
          expectedUtterance: [[{"string": "pagetablist"},
            {"string": "stateSelected"}, {"string": "pagetab"},
            {"string": "objItemOfN", "args": [1, 2]}, "Account"], ["Account",
            {"string": "stateSelected"}, {"string": "pagetab"},
            {"string": "objItemOfN", "args": [1, 2]}, {"string": "pagetablist"}]
          ],
          expectedBraille: [[{"string": "pagetabAbbr"},
            {"string": "objItemOfN", "args": [1, 2]}, "Account"], ["Account",
            {"string": "pagetabAbbr"},
            {"string": "objItemOfN", "args": [1, 2]}]]
        }, {
          // Test unselected tab
          accOrElmOrID: "tab2",
          expectedUtterance: [[{"string": "pagetablist"}, {"string": "pagetab"},
            {"string": "objItemOfN", "args": [2, 2]}, "Advanced"], ["Advanced",
            {"string": "pagetab"}, {"string": "objItemOfN", "args": [2, 2]},
            {"string": "pagetablist"}]],
          expectedBraille: [[{"string": "pagetabAbbr"},
            {"string": "objItemOfN", "args": [2, 2]}, "Advanced"], ["Advanced",
            {"string": "pagetabAbbr"},
            {"string": "objItemOfN", "args": [2, 2]}]]
        }, {
          // Landing on this label should mimic landing on the checkbox.
          accOrElmOrID: "label1",
          expectedUtterance: [[{"string": "stateNotChecked"},
            {"string": "checkbutton"}, "Orange"], ["Orange",
            {"string": "stateNotChecked"}, {"string": "checkbutton"}]],
          expectedBraille: [[{"string": "stateUncheckedAbbr"}, "Orange"],
                            ["Orange", {"string": "stateUncheckedAbbr"}]]
        }, {
          // Here we get a top-level view of the form.
          accOrElmOrID: "form1",
          expectedUtterance: [[{"string": "label"},
            {"string": "stateNotChecked"}, {"string": "checkbutton"}, "Orange",
            "Orange", {"string": "stateNotChecked"}, {"string": "checkbutton"},
            "Blue", {"string": "label"}, "Blue"], ["Orange",
            {"string": "stateNotChecked"}, {"string": "checkbutton"}, "Orange",
            {"string": "label"}, "Blue", {"string": "stateNotChecked"},
            {"string": "checkbutton"}, "Blue", {"string": "label"}]],
          expectedBraille: [[{"string": "labelAbbr"},
            {"string": "stateUncheckedAbbr"}, "Orange", "Orange",
            {"string": "stateUncheckedAbbr"}, "Blue", {"string": "labelAbbr"},
            "Blue"], ["Orange", {"string": "stateUncheckedAbbr"}, "Orange",
            {"string": "labelAbbr"}, "Blue", {"string": "stateUncheckedAbbr"},
            "Blue", {"string": "labelAbbr"}]]
        }, {
          // This is a non-nesting label.
          accOrElmOrID: "label2",
          expectedUtterance: [[{"string": "label"}, "Blue"],
                              ["Blue", {"string": "label"}]],
          expectedBraille: [[{"string": "labelAbbr"}, "Blue"],
                            ["Blue", {"string": "labelAbbr"}]]
        }, {
          // This is a distinct control.
          accOrElmOrID: "input2",
          expectedUtterance: [[{"string": "stateNotChecked"},
            {"string": "checkbutton"}, "Blue"], ["Blue",
            {"string": "stateNotChecked"}, {"string": "checkbutton"}]],
          expectedBraille: [[{"string": "stateUncheckedAbbr"}, "Blue"], ["Blue",
            {"string": "stateUncheckedAbbr"}]]
        }, {
          // This is a nested control.
          accOrElmOrID: "input1",
          expectedUtterance: [[{"string": "stateNotChecked"},
            {"string": "checkbutton"}, "Orange"], ["Orange",
            {"string": "stateNotChecked"}, {"string": "checkbutton"}]],
          expectedBraille: [[{"string": "stateUncheckedAbbr"}, "Orange"],
            ["Orange", {"string": "stateUncheckedAbbr"}]]
        }, {
          // Landing on this label should mimic landing on the entry.
          accOrElmOrID: "label3",
          expectedUtterance: [[{"string": "entry"}, "Joe", "First name:"],
                             ["First name:", "Joe", {"string": "entry"}]],
          expectedBraille: [[{"string": "entryAbbr"}, "Joe", "First name:"],
                            ["First name:", "Joe", {"string": "entryAbbr"}]]
        }, {
          // This is a nested control with a value.
          accOrElmOrID: "input3",
          expectedUtterance: [[{"string": "entry"}, "Joe", "First name:"],
                              ["First name:", "Joe", {"string": "entry"}]],
          expectedBraille: [[{"string": "entryAbbr"}, "Joe", "First name:"],
                            ["First name:", "Joe", {"string": "entryAbbr"}]]
        }, {
          // This is a nested control with a value.
          accOrElmOrID: "input4",
          expectedUtterance: [[{"string": "slider"}, "3", "Points:"],
                              ["Points:", "3", {"string": "slider"}]],
          expectedBraille: [[{"string": "sliderAbbr"}, "3", "Points:"],
                            ["Points:", "3", {"string": "sliderAbbr"}]]
        }, {
          accOrElmOrID: "password",
          expectedUtterance: [[{"string": "passwordtext"}, "Secret Password"],
                              ["Secret Password", {"string": "passwordtext"}]],
          expectedBraille: [[{"string": "passwordtextAbbr"}, "Secret Password"],
                            ["Secret Password", {"string": "passwordtextAbbr"}]]
        }, {
          accOrElmOrID: "input5",
          expectedUtterance: [[{"string": "stateChecked"},
            {"string": "checkbutton"}, "Boring label"], ["Boring label",
            {"string": "stateChecked"}, {"string": "checkbutton"}]],
          expectedBraille: [[{"string": "stateCheckedAbbr"}, "Boring label"],
            ["Boring label", {"string": "stateCheckedAbbr"}]]
        }, {
          accOrElmOrID: "radio_unselected",
          expectedUtterance: [[{"string": "stateNotChecked"},
            {"string": "radiobutton"}, "any old radio button"],
            ["any old radio button", {"string": "stateNotChecked"},
            {"string": "radiobutton"}]
          ],
          expectedBraille: [
            [{"string": "stateUncheckedAbbr"}, "any old radio button"],
            ["any old radio button", {"string": "stateUncheckedAbbr"}]]
        }, {
          accOrElmOrID: "radio_selected",
          expectedUtterance: [[{"string": "stateChecked"},
            {"string": "radiobutton"}, "a unique radio button"],
            ["a unique radio button", {"string": "stateChecked"},
            {"string": "radiobutton"}]],
          expectedBraille: [
            [{"string": "stateCheckedAbbr"}, "a unique radio button"],
            ["a unique radio button", {"string": "stateCheckedAbbr"}]]
        }, {
          accOrElmOrID: "togglebutton_notpressed",
          expectedUtterance: [[{"string": "togglebutton"}, "I am not pressed"],
                              ["I am not pressed", {"string": "togglebutton"}]],
          expectedBraille: [
            [{"string": "stateUnpressedAbbr"}, "I am not pressed"],
            ["I am not pressed", {"string": "stateUnpressedAbbr"}]]
        }, {
          accOrElmOrID: "togglebutton_pressed",
          expectedUtterance: [[{"string": "statePressed"},
            {"string": "togglebutton"}, "I am pressed!"], ["I am pressed!",
            {"string": "statePressed"}, {"string": "togglebutton"}]],
          expectedBraille: [[{"string": "statePressedAbbr"}, "I am pressed!"],
                            ["I am pressed!", {"string": "statePressedAbbr"}]]
        }, {
          accOrElmOrID: "listbox-option",
          expectedUtterance: [[{"string": "listbox"},
            {"string": "listboxoption"}, "Search suggestion"],
            ["Search suggestion", {"string": "listboxoption"},
            {"string": "listbox"}]
          ],
          expectedBraille: [
            [{"string": "listboxoptionAbbr"}, "Search suggestion"],
            ["Search suggestion", {"string": "listboxoptionAbbr"}]]
        }, {
          accOrElmOrID: "listbox-option2",
          oldAccOrElmOrID: "listbox-option",
          expectedUtterance: [[{"string": "listboxoption"}, "555-12345"],
                              ["555-12345", {"string": "listboxoption"}]],
          expectedBraille: [[{"string": "listboxoptionAbbr"}, "555-12345"],
                            ["555-12345", {"string": "listboxoptionAbbr"}]]
        }, {
          accOrElmOrID: "columnheader",
          oldAccOrElmOrID: "grid",
          expectedUtterance: [[{"string": "columnInfo", "args": [1]},
            {"string": "rowInfo", "args" :[1]}, "Sunday"], ["Sunday",
            {"string": "columnInfo", "args": [1]},
            {"string": "rowInfo", "args" :[1]}]],
          expectedBraille: [[{"string": "cellInfoAbbr", "args": [1, 1]},
            "Sunday"], ["Sunday", {"string": "cellInfoAbbr", "args": [1, 1]}]]
        }, {
          accOrElmOrID: "rowheader",
          oldAccOrElmOrID: "grid",
          expectedUtterance: [[{"string": "columnInfo", "args": [1]},
            {"string": "rowInfo", "args": [2]}, "Sunday", "Week 1"], ["Week 1",
            {"string": "columnInfo", "args": [1]},
            {"string": "rowInfo", "args": [2]}, "Sunday"]],
          expectedBraille: [[{"string": "cellInfoAbbr", "args": [1, 2]},
            "Sunday", "Week 1"], ["Week 1",
            {"string": "cellInfoAbbr", "args": [1, 2]}, "Sunday"]]
        }, {
          accOrElmOrID: "gridcell1",
          oldAccOrElmOrID: "grid",
          expectedUtterance: [["3"], ["3"]],
          expectedBraille: [["3"], ["3"]]
        }, {
          accOrElmOrID: "gridcell2",
          oldAccOrElmOrID: "grid",
          expectedUtterance: [["4", "7"], ["4", "7"]],
          expectedBraille: [["4", "7"], ["4", "7"]]
        }, {
          accOrElmOrID: "gridcell3",
          oldAccOrElmOrID: "grid",
          expectedUtterance: [[{"string": "stateSelected"}, "5"],
                              ["5", {"string": "stateSelected"}]],
          expectedBraille: [["5"], ["5"]],
        }, {
          accOrElmOrID: "frequency",
          expectedUtterance: [[{"string": "stateCollapsed"},
            {"string": "stateHasPopup"}, {"string": "combobox"}, "15 min"], [
            "15 min", {"string": "stateCollapsed"}, {"string": "stateHasPopup"},
            {"string": "combobox"}]],
          expectedBraille: [[{"string": "comboboxAbbr"}, "15 min"], ["15 min",
            {"string": "comboboxAbbr"}]]
        }, {
          accOrElmOrID: "selected-combobox-option",
          oldAccOrElmOrID: "frequency",
          expectedUtterance: [[{"string": "stateSelected"},
            {"string": "comboboxoption"}, "15 min"], ["15 min",
            {"string": "stateSelected"}, {"string": "comboboxoption"}]],
          expectedBraille: [[{"string": "comboboxoptionAbbr"}, "15 min"], [
            "15 min", {"string": "comboboxoptionAbbr"}]]
        }, {
          accOrElmOrID: "combobox-option",
          oldAccOrElmOrID: "frequency",
          expectedUtterance: [[{"string": "comboboxoption"}, "30 min"], [
            "30 min", {"string": "comboboxoption"}]],
          expectedBraille: [[{"string": "comboboxoptionAbbr"}, "30 min"], [
            "30 min", {"string": "comboboxoptionAbbr"}]]
        }, {
          accOrElmOrID: "labelled-combobox",
          expectedUtterance: [[{"string": "stateCollapsed"},
            {"string": "stateHasPopup"}, {"string": "combobox"}, "Never",
            "Intervals"], ["Intervals", "Never", {"string": "stateCollapsed"},
            {"string": "stateHasPopup"}, {"string": "combobox"}]],
          expectedBraille: [[{"string": "comboboxAbbr"}, "Never", "Intervals"],
            ["Intervals", "Never", {"string": "comboboxAbbr"}]]
        }, {
          accOrElmOrID: "statusbar-1",
          expectedUtterance: [["Last sync:", "2 days ago"],
                              ["Last sync:", "2 days ago"]],
          expectedBraille: [["Last sync:", "2 days ago"],
                            ["Last sync:", "2 days ago"]]
        }, {
          accOrElmOrID: "statusbar-2",
          expectedUtterance: [["Last sync: 30min ago"],
                              ["Last sync: 30min ago"]],
          expectedBraille: [["Last sync: 30min ago"], ["Last sync: 30min ago"]]
        }, {
          accOrElmOrID: "switch-1",
          expectedUtterance: [[{"string": "stateOn"}, {"string": "switch"},
            "Simple switch"], ["Simple switch", {"string": "stateOn"},
            {"string": "switch"}]],
          expectedBraille: [[{"string": "stateCheckedAbbr"}, "Simple switch"],
            ["Simple switch", {"string": "stateCheckedAbbr"}]]
        }, {
          accOrElmOrID: "switch-2",
          expectedUtterance: [[{"string": "stateOff"},
            {"string": "switch"}, "Another switch"], ["Another switch",
            {"string": "stateOff"}, {"string": "switch"}]],
          expectedBraille: [
            [{"string": "stateUncheckedAbbr"}, "Another switch"],
            ["Another switch", {"string": "stateUncheckedAbbr"}]]
        }];

        // Test all possible utterance order preference values.
        function testOutputOrder(aOutputOrder) {
          return function() {
            SpecialPowers.pushPrefEnv({
              "set": [[PREF_UTTERANCE_ORDER, aOutputOrder]]
            }, function() {
              tests.forEach(function run(test) {
                testOutput(test.expectedUtterance[aOutputOrder], test.accOrElmOrID,
                  test.oldAccOrElmOrID, 1);
                testOutput(test.expectedBraille[aOutputOrder], test.accOrElmOrID,
                  test.oldAccOrElmOrID, 0);
              });
              AccessFuTest.nextTest();
            });
          };
        }

        AccessFuTest.addFunc(testOutputOrder(0));
        AccessFuTest.addFunc(testOutputOrder(1));
        AccessFuTest.waitForExplicitFinish();
        AccessFuTest.runTests();
      }

      SimpleTest.waitForExplicitFinish();
      addA11yLoadEvent(doTest);

    </script>
  </head>
  <body>
    <div id="root">
      <a target="_blank"
         href="https://bugzilla.mozilla.org/show_bug.cgi?id=753984"
         title="[AccessFu] utterance order test">
         Mozilla Bug 753984</a>
      <a target="_blank"
         href="https://bugzilla.mozilla.org/show_bug.cgi?id=758675"
         title="[AccessFu] Add support for accDescription">
         Mozilla Bug 758675</a>
      <a target="_blank"
         href="https://bugzilla.mozilla.org/show_bug.cgi?id=876475"
         title="[AccessFu] Make braille output less verbose">
         Mozilla Bug 876475</a>
      <a target="_blank"
         href="https://bugzilla.mozilla.org/show_bug.cgi?id=924284"
         title="[AccessFu] Output accessible values">
         Mozilla Bug 924284</a>
      <a target="_blank"
         href="https://bugzilla.mozilla.org/show_bug.cgi?id=925845"
         title="[AccessFu] Unify output tests">
         Mozilla Bug 925845</a>
      <p id="display"></p>
      <div id="content" style="display: none"></div>
      <pre id="test"></pre>
      <a id="anchor" href="#test" title="title"></a>
      <a id="anchor_titleandtext" href="#test" title="goes to the tests">Tests</a>
      <a id="anchor_duplicatedtitleandtext" href="#test" title="Tests">Tests</a>
      <a id="anchor_arialabelandtext" href="#test" aria-label="Tests" title="goes to the tests">Tests</a>
      <textarea id="textarea" cols="80" rows="5">
        This is the text area text.
      </textarea>
      <h1 id="heading" title="Test heading"></h1>
      <ol id="list">
        <li id="li_one">list one</li>
      </ol>
      <ul id="unorderd_list">
        <li id="li_two">list two</li>
      </ul>
      <dl id="dlist">
        <dd id="dd_one">
          dd one
        </dd>
      </dl>
      <table>
        <caption>Fruits and vegetables</caption>
        <tr>
          <td id="cell">
            <ul style="list-style-type: none;">
              <li><a id="apples" href="#">Apples</a></li>
              <li><a id="bananas" href="#">Bananas</a></li>
              <li><a href="#">Peaches</a></li>
              <li>
                <a href="#">
                  Plums
                </a>
              </li>
            </ul>
          </td>
        </tr>
      </table>
      <button id="unavailableButton" disabled>I am unavailable</button>
      <button id="expandedButton" aria-expanded="true">I am expanded</button>
      <button id="collapsedButton" aria-expanded="false">I am collapsed</button>
      <input id="requiredInput" required placeholder="I am required" />
      <input id="readonlyInput" readonly value="No edits" />
      <textarea id="readonlyTextarea" readonly>No editing</textarea>
      <button id="hasPopupButton" aria-haspopup="true">I have a popup</button>
      <div role="tablist">
        <a id="tab1" href="#" role="tab" aria-selected="true">Account</a>
        <a id="tab2" href="#" role="tab" aria-selected="false">Advanced</a>
      </div>
      <form id="form1">
        <label id="label1"><input id="input1" type="checkbox">Orange</label>
        <input id="input2" type="checkbox"><label id="label2" for="input2">Blue</label>
      </form>
      <label id="label3">First name: <input id="input3" value="Joe"></label>
      <label id="label4">Points:
        <input id="input4" type="range" name="points" min="1" max="10" value="3">
      </label>
      <label for="input5">Boring label</label><input id="input5" type="checkbox" checked></input>
      <label for="password">Secret Password</label><input id="password" type="password"></input>
      <label for="radio_unselected">any old radio button</label><input id="radio_unselected" type="radio"></input>
      <label for="radio_selected">a unique radio button</label><input id="radio_selected" type="radio" checked></input>
      <input id="email" type="email" value="test@example.com" />
      <input id="search" type="search" value="This is a search" />
      <input id="tel" type="tel" value="555-5555" />
      <input id="url" type="url" value="http://example.com" />
      <input id="textInput" type="text" value="This is text." />
      <label>Points: <input id="range" type="range" name="points" min="1" max="10" value="3"></label>
      <div id="togglebutton_notpressed" aria-pressed="false" role="button" tabindex="-1">I am not pressed</div>
      <div id="togglebutton_pressed" aria-pressed="true" role="button" tabindex="-1">I am pressed!</div>
      <ul role="listbox" style="list-style-type: none;">
        <li role="option" id="listbox-option">Search suggestion</li>
        <li role="option" id="listbox-option2">
          <label aria-hidden="true">
            <input type="checkbox" />
          </label>
          555-12345
        </li>
      </ul>
      <section id="grid" role="grid">
        <ol role="row">
          <li role="presentation"></li>
          <li id="columnheader" role="columnheader" aria-label="Sunday">S</li>
          <li role="columnheader">M</li>
        </ol>
        <ol role="row">
          <li id="rowheader" role="rowheader" aria-label="Week 1">1</li>
          <li id="gridcell1" role="gridcell"><span>3</span><div></div></li>
          <li id="gridcell2" role="gridcell"><span>4</span><div>7</div></li>
        </ol>
        <ol role="row">
          <li role="rowheader">2</li>
          <li id="gridcell3" aria-selected="true" role="gridcell">5</li>
          <li role="gridcell">6</li>
        </ol>
      </section>
      <select id="frequency">
        <option id="selected-combobox-option" value="15">15 min</option>
        <option id="combobox-option" value="30">30 min</option>
        <option value="null">Manual</option>
      </select>
      <select id="labelled-combobox" aria-label="Intervals">
        <option value="15">Every 15 min</option>
        <option value="30">Every 30 min</option>
        <option value="null" selected>Never</option>
      </select>
      <div id="statusbar-1" role="status">Last sync:<span>2 days ago</span></div>
      <div aria-label="Last sync: 30min ago" id="statusbar-2" role="status">I should be ignored</div>
      <span id="switch-1" role="switch" aria-label="Simple switch" aria-checked="true"></span>
      <span id="switch-2" role="switch" aria-label="Another switch" aria-checked="false"></span>
    </div>
  </body>
</html>
